{php include wl_template('common/header');}
<script>
$(function () {
	var list_group_item = document.querySelectorAll(".list-group-item"),
		listlength = list_group_item.length,
		urlstring = location.href;
	for (var i = 0; i < listlength; i++ ) {
		list_group_item[i].classList.remove("active");		
	}
	if (urlstring.indexOf("will_die=will_die")>1) {
		//list_group_item[6].classList.remove("active");
		list_group_item[7].classList.add("active");
	}else if (urlstring.indexOf("do=order&ac=group")>1){
	  list_group_item[6].classList.add("active");
	}
	//list_group_item[1].classList.add("active");
})
</script>
{if $op == 'all' && empty($will_die)}

<ul class="nav nav-tabs">
	<li {if $groupstatus == ''}class="active"{/if}>
        <a href="{php echo web_url('order/group', array('groupstatus' =>''))}">全部团购({$all})</a>
    </li>
    <li{if $groupstatus == 2} class="active"{/if}>
        <a href="{php echo web_url('order/group', array('groupstatus' =>2))}">团购成功({$status2})</a>
    </li>
	<li {if $groupstatus == 1} class="active"{/if}>
        <a href="{php echo web_url('order/group', array('groupstatus' =>1))}">团购失败({$status1})</a>
    </li>
	<li {if  $groupstatus == 3}class="active"{/if}>
        <a href="{php echo web_url('order/group', array('groupstatus' =>3))}">团购中({$status3})</a>
    </li>
   
	{if $op == 'detail'}
    <li class="active">
        <a href="#">订单详情</a>
    </li>
    {/if}
    {if $op == 'tuan_detail'}
    <li class="active">
        <a href="#">团详情</a>
    </li>
    {/if}
</ul>
<div class="main">
    <div class="panel panel-info">
	    <div class="panel-heading">筛选</div>
	    <div class="panel-body">
            <form action="./index.php" method="get" class="form-horizontal" role="form" id="form1">
                <input type="hidden" name="c" value="site" />
                <input type="hidden" name="a" value="entry" />
                <input type="hidden" name="m" value="lexiangpingou" />
                <input type="hidden" name="do" value="order" />
                <input type="hidden" name="ac" value="group" />
                <input type="hidden" name="groupstatus" value="{$groupstatus}" />
                <div class="form-group">
                    <label class="col-xs-12 col-sm-4 col-md-4 col-lg-1 control-label">团ID</label>
                    <div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
                        <input class="form-control" name="keyword" id="" type="text" value="{$_GPC['keyword']}" placeholder="可查询团ID">
                    </div>
                    <label class="col-xs-12 col-sm-4 col-md-4 col-lg-1 control-label">商品搜索</label>
                    <div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
                        <select name="goods" class="form-control">
                            <option value="">--所有--</option>
                            {loop $allgoods $key $type}
                            <option value="{$type['gname']}" >{$type['gname']}</option>
                            {/loop}
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-4 col-md-4 col-lg-1 control-label">商品搜索</label>
                    <div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
                        <input class="form-control" name="goods2" id="" type="text" value="{$_GPC['goods2']}" placeholder="可查询商品名称/商品ID">
                    </div>
                     <label class="col-xs-12 col-sm-4 col-md-4 col-lg-1 control-label">开团时间</label>
                        <div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
                            {php echo tpl_form_field_daterange('time', array('starttime'=>date('Y-m-d H:i:s', $starttime),'endtime'=>date('Y-m-d H:i:s', $endtime)),true);}
                        </div>
                        <div class="col-sm-3 col-lg-2" style="text-align:right;"><button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
                        </div>
                </div>
            </form>
           <a href='{php echo web_url('order/group', array('op' => 'output','groupstatus'=>$groupstatus,'starttime'=>$starttime,'endtime'=>$endtime,'keyword'=>$_GPC['keyword'],'goods'=>$_GPC['goods'],'goods2'=>$_GPC['goods2']))}'><button class="btn btn-info"><i class="fa fa-download"></i> 导出组团记录</button></a>
	    </div>
	</div>

	<div class="panel panel-default">
		<div class="panel-body table-responsive">
			<table class="table table-hover table-bordered">
				<thead class="navbar-inner">
					<tr>
						<th style="width:100px; text-align: center;">团编号</th>
						<th style="width:220px;text-align: center;">商品名称</th>
						<th style="width:60px;text-align: center;">状态</th>
						<th style="width:80px;text-align: center;">进度</th>
						<th style="width:170px;text-align: center;">时间</th>
						<th style="width:170px;text-align: center;">成交金额</th>
						<th style="width:60px;text-align: center;">已发货</th>
						<th style="width:220px; text-align: center;">操作</th>
					</tr>
				</thead>
				<tbody style="text-align: center;">
					{loop $alltuan $key $item}
					<tr>
						<td>{$item['groupnumber']}</td>
						<td>{$item['goodsname']}
						</td>
						<td>
							{if $item['groupstatus']==1 }
								<span class="label label-warning">失败</span>
							{/if}
							{if $item['groupstatus']==2 }
								 <span class="label label-success">成功</span>
							{/if}
							{if $item['groupstatus']==3 }
								 <span class="label label-info">进行</span>
							{/if}
						</td>
						<td>
							{if $item['selltype']==7}
							<font color="red">{php echo $item['nownum']}</font>
							{else}
							<font color="red">{php echo $item['neednum']-$item['lacknum']}</font>/{$item['neednum']}
							{/if}
						</td>
						<td>开团:{php echo date('Y-m-d H:i', $item['starttime'])}<br>{if $item['groupstatus']!=2 }到期:{php echo date('Y-m-d H:i', $item['endtime'])}{/if}{if $item['groupstatus']==2 }成功:{php echo date('Y-m-d H:i', $item['successtime'])}{/if}</td>
						<?php 
								$totalprice=pdo_fetch("select sum(price) as price from ".tablename('tg_order')." where status in (1,2,3,8) and tuan_id=".$item['groupnumber']);
						$tprice=number_format($totalprice['price'],2);
						?>
						<td>{$tprice}</td>
						<td>
							{if $item['sendnum']>0}
							<span class="label label-danger">{$item['sendnum']}人</span>
							{else}
							<span class="label label-default">0人</span>
							{/if}
						</td>
						<td style="text-align:right;">
						{if $item['groupstatus']==3}
						<a href="{php echo web_url('order/group/passdate', array('groupnumber' => $item['groupnumber']))}" class="btn btn-danger btn-sm" >立即到期</a><br>
							{/if}	
							{if $item['groupstatus']==1&&$item['sendtype']!=1}
								{if $item['refundnum']==($item['neednum']-$item['lacknum'])}
								<span class="label label-warning">整团已退</span>
								
								{else}
								<a href="{php echo web_url('order/group/sendgroup', array('groupnumber' => $item['groupnumber']))}" class="btn btn-danger btn-sm" >强制发货</a>
								
								<a href="{php echo web_url('order/group/refundgroup', array('groupnumber' => $item['groupnumber']))}" class="btn btn-danger btn-sm" onclick="return confirm('此操作不可恢复，确认退款？');" style="margin-bottom:2px;">整团退款</a>
								
								
								{/if}
								
								
							{/if}
							
							
							{if $item['groupstatus']==2&&$item['goodstype']==2&&$item['sendnum']>0}
							 <a class="label label-primary" href="javascript:;" onclick="$('#modal-confirmsend').find(':input[name=id]').val('{$item['groupnumber']}')" data-toggle="modal" data-target="#modal-confirmsend">邻购发货</a>
							<!--<a href="{php echo $this->createWebUrl('grouporder', array('op' => 'sendgroup', 'groupnumber' => $item['groupnumber']))}" class="btn label-warning btn-sm" >邻购发货</a>
							<a href="{php echo $this->createWebUrl('grouporder', array('op' => 'print', 'groupnumber' => $item['groupnumber']))}" class="label label-warning btn-sm" >邻购打印</a>	-->
							{/if}
							
							<br>
						
							<a href="{php echo web_url('order/group/print', array('groupnumber' => $item['groupnumber']))}" class="btn btn-warning btn-sm" >小票打印</a>	
							
							
							<a href="{php echo web_url('order/group/group_detail', array('groupnumber' => $item['groupnumber']))}" class="btn btn-success btn-sm">查看详情</a>
						</td>
					</tr>
					{/loop}
				</tbody>
			</table>
		</div>
	</div>
</div>
{$pager}
<script type="text/javascript">
	require(['daterangepicker'], function($){
		$('.daterange').on('apply.daterangepicker', function(ev, picker) {
			$('#form1')[0].submit();
		});
	});
</script>
{/if}
{if $op=='group_detail'}
<style type="text/css">
.main .form-horizontal .form-group{margin-bottom:0;}
.main .form-horizontal .modal .form-group{margin-bottom:15px;}
#modal-confirmsend .control-label{margin-top:0;}
</style>
<div class="main">
	<form class="form-horizontal form" action="{php echo web_url('order/group/group_detail', array('groupnumber' => $thistuan['groupnumber'],'type'=>'submit'))}" method="post" enctype="multipart/form-data" onsubmit="return formcheck(this)">
		<div class="panel panel-default">
			<div class="panel-heading">
				团信息
			</div>
			<div class="panel-body">
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">团ID :</label>
					<div class="col-sm-9 col-xs-12">
						<p class="form-control-static">{$groupnumber}</p>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">需要人数 :</label>
					<div class="col-sm-9 col-xs-12">
						<p class="form-control-static">{$thistuan['neednum']}</p>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">缺少人数 :</label>
					<div class="col-sm-9 col-xs-12">
						<p class="form-control-static">{$thistuan['lacknum']}</p>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">团状态:</label>
					<div class="col-sm-9 col-xs-12">
						<p class="form-control-static">
                        	{if $thistuan['groupstatus']==1 }
								<span class="label label-default">组团失败</span>
							{/if}
							{if $thistuan['groupstatus']==2 }
								 <span class="label label-success">组团成功</span>
							{/if}
							{if $thistuan['groupstatus']==3 }
								 <span class="label label-warning">组团中</span>
							{/if}
						</p><!--<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modal-getgoods2">修改团状态</button>-->
					</div>
				</div>
			</div>
			<!--修改团状态-->
		<!--<div id="modal-getgoods2" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true" style="width:600px;margin:0px auto;">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
						<h3>修改团状态</h3>
					</div>
					<div class="modal-body">
						<div class="form-group">
							<label class="col-xs-10 col-sm-3 col-md-3 control-label">团状态</label>
							<div class="col-xs-12 col-sm-9 col-md-8 col-lg-8">
								<select class="form-control" name="thestatus" id="express">
					              <option value="">团状态</option>
					              <option value="1" {if $thistuan['groupstatus']==1}selected="selected"{/if}>组团失败</option>
					              <option value="2" {if $item['groupstatus']==2}selected="selected"{/if}>组团成功</option>
					              </select>
							</div>
						
						</div>
						<div class="modal-footer">
							<button type="submit" class="btn btn-primary span2" name="editstatus" value="yes" onclick="return confirm('此操作也将修改整个团所有订单的状态！确认？');">确认修改</button>
							<a href="#" class="btn btn-default" data-dismiss="modal" aria-hidden="true">关闭</a>
						</div>
					</div>
				</div>
			</div>
		</div>-->
		<!--修改团状态-->
	</div>
	</form>
	   	<div class="panel panel-default">
	   	<div class="panel-heading">
			用户信息
		</div>
	   	<div class="panel-body table-responsive">
	   		<table class="table table-hover">
	   			<thead class="navbar-inner">
	   				<tr>
	   					
	   					<th style="width:80px;">排序</th>
	   					<th style="width:70px;">姓名</th>
	   					<th style="width:100px;">电话</th>
	   					<th style="width:80px;">支付方式</th>
	   					<th style="width:80px;">订单状态</th>
	   					<th style="width:60px;">运费</th>
	   					<th style="width:60px;">总价</th>
	   					<th style="width:140px;">下单时间</th>
	   					<th style="width:220px;">地址</th>
	   					<th style="width:100px; text-align:right;">操作</th>
	   				</tr>
	   			</thead>
	   			<tbody>
	   				{php  $i=1;}
	   				{loop $orders $key $item}
	   				<tr>
	   					<td>{php echo $i++}</td>
	   					<td>{if $item['tuan_first']==1}<span class="label label-warning">团</span>{/if}{$item['addname']}</td>
	   					<td>{$item['mobile']}</td>
	   					<td>
	   					{if $item['pay_type'] == 0}
	   					未支付
	   					{/if}
	   					{if $item['pay_type'] == 1}
	   					在线
	   					{/if}
	   					{if $item['pay_type'] == 2}
	   					微信支付
	   					{/if}
	   					{if $item['pay_type'] == 3}
	   					货到付款
	   					{/if}
	   					</td>
	   					<td>
						{if $item['status'] == 0}
	   					<span class="label label-danger">待付款</span>
	   					{/if}
	   					{if $item['status'] == 1}
	   					<span class="label label-info">已付款</span>
	   					{/if}
	   					{if $item['status'] == 2}
	   					 <span class="label label-warning">待收货</span>
	   					{/if}
	   					{if $item['status'] == 3}
	   					<span class="label label-success">已完成</span>
	   					{/if}
	   					{if $item['status'] == 4}
	   					<span class="label label-success">已退款</span>
	   					{/if}
	   					{if $item['status'] == 5}
	   					<span class="label label-default">强退款</span>
	   					{/if}
	   					{if $item['status'] == 6}
	   					<span class="label label-danger">部分退款</span>
	   					{/if}
	   					{if $item['status'] == 7}
	   					<span class="label label-default">已退款</span>
	   					{/if}
						{if $item['status'] == 8}
	   					<span class="label label-default">待使用</span>
	   					{/if}
						{if $item['status'] == 9}
	   					<span class="label label-default">已取消</span>
	   					{/if}
						{if $item['status'] == 10}
	   					<span class="label label-default">待退款</span>
	   					{/if}
	   					</td>
	   					<td>{$item['freight']} 元</td>
	   					<td>{$item['price']} 元</td>
	   					<td>{php echo date('Y-m-d H:i:s', $item['createtime'])}</td>
	   					<td>{$item['address']}</td>
	   					<td style="text-align:right;">
	   						<a href="{php echo web_url('order/order/detail', array('id' => $item['id'],'is_tuan'=>1))}" class="btn btn-success btn-sm">查看订单</a>
	   					</td>
	   				</tr>
	   				{/loop}
	   			</tbody>
	   		</table>
	   	</div>
	   	</div>
	   	
		<div class="panel panel-default">
			 <div class="panel-heading">
				商品信息
			</div> 
			<div class="panel panel-default">
				<div class="table-responsive">
					<table class="table table-hover">
						<thead>
						<tr>
							<th style="width:80px;">商品图</th>
							<th style="width:180px;">商品名</th>
							<th class="text-center" style="width:80px;">团购价</th>
							<th class="text-center" style="width:80px;">单买价</th>
							<th class="text-center" style="width:80px;text-align:center;">市场价</th>
						</tr>
						</thead>
						<tbody>
						<tr data-toggle="popover" data-trigger="hover" data-placement="left" class="js-goods-img">
							<td><img class="scrollLoading" src="{IMAGE_PIXEL}" data-url="{$goods['gimg']}" onerror="this.src='{IMAGE_NOPIC_SMALL}'" height="50" width="50"/></td>
							<td class="line-feed">
								{php echo cutstr($goods['gname'], 30, true);}
							</td>
							<td class="line-feed">
								{php echo cutstr($goods['gprice'], 30, true);}
							</td>
								<td class="line-feed">
								{php echo cutstr($goods['oprice'], 30, true);}
									<td class="line-feed" style="text-align:center;">
								{php echo cutstr($goods['mprice'], 30, true);}
							</td>
							</td>
							<!--<td class="text-center">
								<span class="">{if empty($goods['merchant']['name'])}{$_W['account']['name']}{else}{$goods['merchant']['name']}{/if}</span>
							</td>-->
							
						</tr>
						</tbody>
					</table>
				</div>
			</div>
		</div>
</div>
<script>
$(function(){
		$(".scrollLoading").scrollLoading();
		var $pop = null;
		$('.scrollLoading').hover(function(){
			var img = $(this).attr('src');
			var obj = this;
			var $pop = util.popover(obj, function($popover, obj){
				obj.$popover = $popover;
			}, '<div><img src="'+img+'" style="max-width:200px; max-height:200px;"></div>');
		}, function(){
			this.$popover.remove();
		});
	});
</script>
{/if}
{if $op == 'all' &&  !empty($will_die)}
<ul class="nav nav-tabs">
		<li {if $groupstatus == ''}class="active"{/if}>
        <a href="{php echo web_url('order/group', array('groupstatus' =>''))}">全部团购</a>
    </li>
    <li{if $groupstatus == 2} class="active"{/if}>
        <a href="{php echo web_url('order/group', array('groupstatus' =>2))}">团购成功</a>
    </li>
	<li {if $groupstatus == 1} class="active"{/if}>
        <a href="{php echo web_url('order/group', array('groupstatus' =>1))}">团购失败</a>
    </li>
	<li {if  $groupstatus == 3 && empty($will_die)}class="active"{/if}>
        <a href="{php echo web_url('order/group', array('groupstatus' =>3))}">团购中</a>
    </li>
   
	{if $op == 'detail'}
    <li class="active">
        <a href="#">订单详情</a>
    </li>
    {/if}
    {if $op == 'tuan_detail'}
    <li class="active">
        <a href="#">团详情</a>
    </li>
    {/if}
</ul>
<div class="main">
    <div class="panel panel-info">
	    <div class="panel-heading">筛选</div>
	    <div class="panel-body">
            <form action="./index.php" method="get" class="form-horizontal" role="form" id="form1">
               <input type="hidden" name="c" value="site" />
                <input type="hidden" name="a" value="entry" />
                <input type="hidden" name="m" value="lexiangpingou" />
                <input type="hidden" name="do" value="order" />
                <input type="hidden" name="ac" value="group" />
                <input type="hidden" name="groupstatus" value="{$groupstatus}" />
                <input type="hidden" name="will_die" value="{$will_die}" />
				<div class="col-xs-12 col-sm-3" >
					<input type="text" name="endhour" class="form-control" value="{$endhour}"  placeholder="可查询离团结束还差几小时."/>
					<label class="control-label">(该小时后团购将失败.)</label>
				</div>
				<div class="col-xs-12 col-sm-3" >
					<input type="text" name="lacknumber" class="form-control" value="{$lacknumber}" placeholder="可查询团还差几人."/>
					<label class="control-label">(缺少该人数的团.)</label>
				</div>
                <div class="col-xs-12 col-sm-3">
                    <input class="form-control" name="goods3" id="" type="text" value="{$_GPC['goods3']}" placeholder="可查询商品名称/商品ID">
                </div>
                <div class="form-group">
                       <div class="col-sm-3 col-lg-11" style="text-align:right;"><button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
                   </div>
                <div class="form-group">
                </div>
            </form>
<!--            <a href='{php echo $this->createWebUrl('grouporder', array('op' => 'output','groupstatus'=>$groupstatus,'starttime'=>$starttime,'endtime'=>$endtime))}'><button class="btn btn-info"><i class="fa fa-download"></i> 导出组团记录</button></a>
-->		    </div>
	</div>
</div>
	<div class="panel panel-default">
		<div class="panel-body table-responsive">
			<table class="table table-hover">
				<thead class="navbar-inner">
					<tr>
						<th style="width:10%;">团购编号</th>
						<th style="width:30%;">商品</th>
						<th style="width:10%;">团购状态</th>
						<th style="width:10%;">人数 / 总需</th>
						<th style="width:10%;">开团时间</th>
						<th style="width:10%;">到期时间</th>
						<th style="width:30%; text-align:right;">操作</th>
					</tr>
				</thead>
				<tbody>
					{loop $alltuan $key $item}
					<tr>
						<td>{$item['groupnumber']}</td>
						<td><img class="scrollLoading" src="{IMAGE_PIXEL}" data-url="{$item['goods']['gimg']}" onerror="this.src='{IMAGE_NOPIC_SMALL}'" height="50" width="50"/>{php echo cutstr($item['goods']['gname'], 30, true);}</td>
						<td><span class="label label-info">组团中</span></td>
						<td><font color="red">{php echo $item['neednum']-$item['lacknum']}</font> / {$item['neednum']}</td>
						<td>{php echo date('H:i', $item['starttime'])}<br>{php echo date('Y/m/d', $item['starttime'])}</td>
						<td>{php echo date('H:i', $item['endtime'])}<br>{php echo date('Y/m/d', $item['endtime'])}</td>
						<td style="text-align:right;">
							<a href="{php echo web_url('order/group/autogroup', array('groupnumber' => $item['groupnumber']))}" class="btn btn-danger btn-sm" >点击成团</a>
							<a href="{php echo web_url('order/group/group_detail', array('groupnumber' => $item['groupnumber']))}" class="btn btn-success btn-sm">查看团信息</a>
						</td>
					</tr>
					{/loop}
				</tbody>
			</table>
		</div>
	</div>
</div>
{$pager}
<script>
$(function(){
		$(".scrollLoading").scrollLoading();
		var $pop = null;
		$('.scrollLoading').hover(function(){
			var img = $(this).attr('src');
			var obj = this;
			var $pop = util.popover(obj, function($popover, obj){
				obj.$popover = $popover;
			}, '<div><img src="'+img+'" style="max-width:200px; max-height:200px;"></div>');
		}, function(){
			this.$popover.remove();
		});
	});
</script>
{/if}
{if $op=='autogroup'}
<style type="text/css">
.main .form-horizontal .form-group{margin-bottom:0;}
.main .form-horizontal .modal .form-group{margin-bottom:15px;}
#modal-confirmsend .control-label{margin-top:0;}
</style>
<ul class="nav nav-tabs">
	<li {if $groupstatus == '' && $op==''}class="active"{/if}>
        <a href="{php echo $this->createWebUrl('grouporder', array('groupstatus' =>''))}">全部团购</a>
    </li>
    <li{if $groupstatus == 2} class="active"{/if}>
        <a href="{php echo $this->createWebUrl('grouporder', array('groupstatus' =>2))}">团购成功</a>
    </li>
	<li {if $groupstatus == 1} class="active"{/if}>
        <a href="{php echo $this->createWebUrl('grouporder', array('groupstatus' =>1))}">团购失败</a>
    </li>
	<li {if  $groupstatus == 3 && empty($will_die)}class="active"{/if}>
        <a href="{php echo $this->createWebUrl('grouporder', array('groupstatus' =>3))}">团购中</a>
    </li>
    <li {if  $groupstatus == 3 && !empty($will_die)&&$op==''}class="active"{/if}>
        <a href="{php echo $this->createWebUrl('grouporder', array('groupstatus' =>3,'will_die'=>'will_die'))}">即将团购失败的团</a>
    </li>
	{if $op=='autogroup'}
    <li class="active">
        <a href="#">自动成团</a>
    </li>
    {/if}
</ul>
<div class="main">
	<form class="form-horizontal form" action="" method="post" enctype="multipart/form-data" onsubmit="return formcheck(this)">
		<input type="hidden" name="dispatchid" value="{$dispatch['id']}" />
		<div class="panel panel-default">
			<div class="panel-heading">
				团信息
			</div>
			<div class="panel-body">
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">团ID :</label>
					<div class="col-sm-9 col-xs-12">
						<p class="form-control-static">{$groupnumber}</p>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">需要人数 :</label>
					<div class="col-sm-9 col-xs-12">
						<p class="form-control-static">{$thistuan['neednum']}</p>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">缺少人数 :</label>
					<div class="col-sm-9 col-xs-12">
						<p class="form-control-static">{$thistuan['lacknum']}</p>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">团状态:</label>
					<div class="col-sm-9 col-xs-12">
						<p class="form-control-static">
                       {if $thistuan['groupstatus']==1 }
								<span class="label label-warning">组团失败</span>
							{/if}
							{if $thistuan['groupstatus']==2 }
								 <span class="label label-success">组团成功</span>
							{/if}
							{if $thistuan['groupstatus']==3 }
								 <span class="label label-info">组团中</span>
							{/if}
						</p>
					</div>
				</div>
			</div>
		</div>
	   	<div class="panel panel-default">
	   	<div class="panel-heading">
			已购买用户信息
		</div>
	   	<div class="panel-body table-responsive">
	   		<table class="table table-hover">
	   			<thead class="navbar-inner">
	   				<tr>
	   					<th style="width:80px;">订单号</th>
	   					<th style="width:70px;">姓名</th>
	   					<th style="width:100px;">电话</th>
	   					<th style="width:80px;">支付方式</th>
	   					<th style="width:80px;">订单状态</th>
	   					<th style="width:60px;">运费</th>
	   					<th style="width:60px;">总价</th>
	   					<th style="width:140px;">下单时间</th>
	   					<th style="width:220px;">地址</th>
	   					<th style="width:100px; text-align:right;">操作</th>
	   				</tr>
	   			</thead>
	   			<tbody>
	   				{loop $orders $item}
	   				<tr>
	   					<td>{$item['orderno']}</td>
	   					<td>{$item['addname']}</td>
	   					<td>{$item['mobile']}</td>
	   					<td>
	   					{if $item['pay_type'] == 0}
	   					未支付
	   					{/if}
	   					{if $item['pay_type'] == 1}
	   					在线
	   					{/if}
	   					{if $item['pay_type'] == 2}
	   					微信支付
	   					{/if}
	   					{if $item['pay_type'] == 3}
	   					货到付款
	   					{/if}
	   					</td>
	   					<td>
						{if $item['status'] == 0}
	   					<span class="label label-danger">待付款</span>
	   					{/if}
	   					{if $item['status'] == 1}
	   					<span class="label label-info">已付款</span>
	   					{/if}
	   					{if $item['status'] == 2}
	   					 <span class="label label-warning">待收货</span>
	   					{/if}
	   					{if $item['status'] == 3}
	   					<span class="label label-success">已完成</span>
	   					{/if}
	   					{if $item['status'] == 4}
	   					<span class="label label-success">已退款</span>
	   					{/if}
	   					{if $item['status'] == 5}
	   					<span class="label label-default">强退款</span>
	   					{/if}
	   					{if $item['status'] == 6}
	   					<span class="label label-danger">部分退款</span>
	   					{/if}
	   					{if $item['status'] == 7}
	   					<span class="label label-default">已退款</span>
	   					{/if}
						{if $item['status'] == 8}
	   					<span class="label label-default">待使用</span>
	   					{/if}
						{if $item['status'] == 9}
	   					<span class="label label-default">已取消</span>
	   					{/if}
						{if $item['status'] == 11}
	   					<span class="label label-default">待退款</span>
	   					{/if}
	   					</td>
	   					<td>{$goods['freight']} 元</td>
	   					<td>{$item['price']} 元</td>
	   					<td>{php echo date('Y-m-d H:i:s', $item['createtime'])}</td>
	   					<td>{$item['address']}</td>
	   					<td style="text-align:right;">
	   						<a href="{php echo $this->createWebUrl('order', array('op' => 'detail', 'id' => $item['id'],'is_tuan'=>1))}" class="btn btn-success btn-sm">查看订单</a>
	   						<a href="{php echo $this->createWebUrl('order', array('id' => $item['id'], 'op' => 'delete'))}" onclick="return confirm('此操作不可恢复，确认删除？');"
	   							class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="bottom" title="删除"><i class="fa fa-times"></i>
	   						</a>
	   					</td>
	   				</tr>
	   				{/loop}
	   			</tbody>
	   		</table>
	   	</div>
	   	</div>
		<div class="panel panel-default">
			 <div class="panel-heading">
				商品信息
			</div> 
			<div class="panel-body table-responsive">
				<table class="table table-hover">
					<thead class="navbar-inner">
					<tr>
						<th style="width:5%;">ID</th>
						<th style="width:15%;">商品标题</th>
						<th style="width:15%;">商品图片</th>
						<th style="width:15%;">团购价</th>
						<th style="width:15%;">单买价</th>
						<th style="width:15%;">市场价</th>
						<th style="width:10%;">数量</th>
						<th style="width:10%;">操作</th>
					</tr>
					</thead>
					<tr>
						<td>{$goods['id']}</td>
						<td>{$goods['gname']}</td>
						<td>
						<div style=" width:40px;height:40px;">
                            <img src="{$_W['attachurl']}{$goods['gimg']}" style=" width:40px;height:40px;" alt="" title="">
                        </div>  
						</td>
						<td>{$goods['gprice']}元</td>
						<td>{$goods['oprice']}元</td>
						<td>{$goods['mprice']}元</td>
						<td>{$goods['gnum']}</td>
						<td>
							<a href="{php echo $this->createWebUrl('goods', array('id' => $goods['id'], 'op' => 'edit'))}" class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="bottom" title="编辑"><i class="fa fa-edit"></i></a>
						</td>
					</tr>
				</table>
			</div>
		</div>
	</form>
</div>
{/if}
<script>
	require(['bootstrap'],function($){
		$('.btn').hover(function(){
			$(this).tooltip('show');
		},function(){
			$(this).tooltip('hide');
		});
	});
	
</script>
{php include wl_template('common/footer');}